<!DOCTYPE html>
<?php
require_once("database.php");
session_start();
  if(!isset($_SESSION['isLogin']) || !$_SESSION['isLogin'])
  {
    header("location:/index.php");
  }

$plate_number_sql = "SELECT id,plate_number FROM gps_record";
$plate_number = query($db,$plate_number_sql);

$current_plate_number = isset($_GET['plate_number'])?$_GET['plate_number']:1; 


?>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
    <style type="text/css">
        body, html{margin:0;font-family:"微软雅黑";}
    </style>
    <title>GPS</title>
</head>
<body>
<div class="pull-left">
    <div style="float: left; padding:20px;">
	当前用户：<?php echo $_SESSION['username']?><br /><br />
	<fieldset> <legend>汽车运行监控系统</legend>
	<div>
        <label>车牌号：</label>
        <select id="plate_change" style="width: 150px;">
                <?php foreach($plate_number as $key=>$row){?>
                    <option <?php if($current_plate_number == $row['id']){?>selected="selected"<?php }?> value = "<?php echo $row['id']?>"><?php echo $row['plate_number']?></option>
                <?php }?>
        </select>
		</div>
        <br />
        <div>时间：<?php echo date("Y年m月d日",time());?>&nbsp;<span  id="time"></span>&nbsp;</div>
		<br />
        <div>速度：<b style="color:green;"  id="speed">0</b>&nbsp;km/h</div>&nbsp;&nbsp;
		<div><span id="long"></span></div><br />
		<div><span id="lati"></span></div>
	</fieldset>
	
	<div style="margin-top:20px;"><a href="/index.php?logout=1">退出</a></div>
    </div>
</div>
<div class="pull-left">
    <iframe frameborder=0 width=800 height=500 marginheight=0 marginwidth=0 scrolling=no src="/map.php?plate_number=<?php echo $current_plate_number?>"></iframe>
</div>
        
</body>
</html>
<script src="/js/jquery.js"></script>
<script type="text/javascript">
    $("#plate_change").change(function(){
        var plate_number = $(this).val();
        window.location.href="/main.php?plate_number="+plate_number;
    });
</script>

